import {defineStore} from "pinia";
import {computed, ref} from "vue";

export const useCounter = defineStore('counter', () => {
    const count = ref(0)
    const doubleCounter = computed(() => {
        return count.value * 2
    })
    const increment = () => {
        count.value += 1
        console.log(count.value)
    }
    const ass = () => {
        increment().then(res => {
            count.value -= 1
        })
        console.log(count.value)
    }

    return {count, doubleCounter, increment, ass}
})